﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Media.Animation;
using TowerDefender.Model;

namespace TowerDefender.Graphics.Animated.Mobs
{
    /// <summary>
    /// Interaction logic for Peon.xaml
    /// </summary>
    public partial class PeonGraphics : UserControl
    {
        public Peon peon { get; set; }
        public Map map { get; set; }

        public PeonGraphics(Peon p, Map m)
        {
            InitializeComponent();
            peon = p;
            map = m;
            p.CoordinatesChanged += new EventHandler(p_CoordinatesChanged);
        }

        void p_CoordinatesChanged(object sender, EventArgs e)
        {
            if (peon.Coordinates == map.MapPath.Points[map.MapPath.Points.Count - 1])
                this.Visibility = System.Windows.Visibility.Hidden;

            PeonManager.DrawPeon(this, peon, map);
        }
    }
}
